package com.reform.controller.expert;


import com.reform.pojo.expert.ExpertScore;
import com.reform.res.Result;
import com.reform.service.IExpertScoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author mortale
 * @since 2021-08-25
 */
@Api(tags = "ExpertScoreController")
@RestController
@RequestMapping("/expert-score")
public class ExpertScoreController {
    @Autowired
    IExpertScoreService expertScoreService;

    @ApiOperation(value = "创建专家成绩", notes = "创建专家成绩")
    @PostMapping("/creatExpertScore")
    public Result creatExpertLabel(ExpertScore expertScore) throws SQLException {
        return expertScoreService.creatExpertScore(expertScore);
    }

    @ApiOperation(value = "删除专家成绩", notes = "删除专家成绩")
    @PostMapping("/deleteExpertScore")
    public Result deleteExpertScore(ExpertScore expertScore) throws SQLException {
        return expertScoreService.deleteExpertScore(expertScore);
    }

    @ApiOperation(value = "修改专家成绩", notes = "修改专家成绩")
    @PostMapping("/updateExpertScore")
    public Result updateExpertScore(ExpertScore expertScore) throws SQLException {
        return expertScoreService.updateExpertScore(expertScore);
    }

    @ApiOperation(value = "获取所有专家成绩", notes = "获取所有专家成绩")
    @GetMapping("/getExpertScores")
    public Result getExpertScores() throws SQLException {
        return expertScoreService.getExpertScores();
    }

    @ApiOperation(value = "通过pro_id获取所有专家成绩", notes = "通过pro_id获取所有专家成绩")
    @PostMapping("/getExpertScoreByProId")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "proId", value = "项目id", paramType = "query", dataTypeClass = String.class, required = true),
    })
    public Result getExpertScoreByProId(String proId) throws SQLException {
        return expertScoreService.getExpertScoreByProId(proId);
    }
}
